package com.idrem.views.bf;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;

import com.idrem.R;

public class MdSearchActivity extends Activity {

	private static String TAG = "MdSearchActivity";
	private String str_searchKey = "";
	private ImageButton btn_search = null;
	private EditText ed_searchKey = null;
	private ImageButton btn_backspace = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_md_search);

		btn_search = (ImageButton) findViewById(R.id.btn_search);
		btn_search.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// start search by searchkey
//				AppLog.i(TAG, " start search by searchkey");
				Toast.makeText(getApplicationContext(),
						"start search by searchkey", Toast.LENGTH_SHORT).show();
				// update search result list
			}
		});

		ed_searchKey = (EditText) findViewById(R.id.ed_searchKey);

		btn_backspace = (ImageButton) findViewById(R.id.btn_backspace);
		btn_backspace.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// delete search key action start
				int str_len = ed_searchKey.getText().length();
				str_searchKey = ed_searchKey.getText()
						.delete(str_len - 1, str_len).toString();
				ed_searchKey.setText(str_searchKey);

			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
//		getMenuInflater().inflate(R.menu.activity_md_search, menu);
		return true;
	}
}
